import { RouteRecordRaw } from "vue-router";
import UserLayout from "@/page/Layout/User.vue";
import CenterLayout from "@/layouts/Center.vue";
import { hadAuthMeta, noAuthMeta } from '@/router/config';

const routes: Array<RouteRecordRaw> = [
  {
    path: "/",
    name: "欢迎",
    redirect: '/center/index',
  },
  {
    path: "/user",
    component: UserLayout,
    redirect: "/user/login",
    children: [
      {
        path: "login",
        name: "登陆",
        meta: noAuthMeta,
        component: () =>
          import(/* webpackChunkName: "page" */ "@/page/User/Login/index.vue"),
      },
      {
        path: "register",
        name: "注册",
        meta: noAuthMeta,
        component: () =>
          import(/* webpackChunkName: "page" */ "@/page/User/Register/index.vue"),
      },
    ],
  },
  {
    path: '/center',
    name: '个人中心',
    redirect: '/center/index',
    component: CenterLayout,
    children: [
      {
        path: 'index',
        name: "首页",
        meta: hadAuthMeta,
        component: () => import(/* webpackChunkName: "page" */ "@/page/Center/index/index.vue"),
      },
    ],
  },
];

export default routes;
